package com.sike.javacore.serializer.serializable;

import com.sike.javacore.serializer.serializable.dto.Person;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class Serializable01 {

    public static void main(String[] args) throws Exception {
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("person01.txt"));
        Person person01 = new Person("张三",35,175.4F);
        oos.writeObject(person01);
        oos.close();

        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("person01.txt"));
        Person person011 = (Person) ois.readObject();
        System.out.println("person01.txt 反序列化内容：" + person011.toString());
    }
}
